package com.yqz.bussi.controller;

import com.yqz.bussi.form.BussiPaymentRecordForm;
import com.yqz.bussi.query.BussiPaymentRecordQuery;
import com.yqz.bussi.service.BussiPaymentRecordService;
import com.yqz.common.base.controller.BaseController;
import com.yqz.common.validator.ValidatorUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("bussi/payment")
public class BussiPaymentRecordController extends BaseController<BussiPaymentRecordQuery, BussiPaymentRecordForm> {

    @Autowired
    private BussiPaymentRecordService bussiPaymentRecordService;

    public BussiPaymentRecordController(BussiPaymentRecordService bussiPaymentRecordService) {
        super(bussiPaymentRecordService);
    }

    @RequestMapping("addPayMent.do")
    public Object addPayMent(@RequestParam("payImgFile") MultipartFile payImg, BussiPaymentRecordForm bussiPaymentRecordForm){
        ValidatorUtil.validate(bussiPaymentRecordForm);
        return bussiPaymentRecordService.addPayMent(payImg,bussiPaymentRecordForm);
    }

    @RequestMapping("updateState.do")
    public Object updateState(@RequestParam("id") Integer id, @RequestParam("state")Integer state){
        return bussiPaymentRecordService.updateState(id,state);
    }

    @RequestMapping("uncheckCount.do")
    public Object uncheckCount(){
        return bussiPaymentRecordService.queryUnCheckCount();
    }

}
